package com.zhilianzhonghe.jinyu.fragment;

import java.util.List;

import tools_util.JSONParseUtils;

import com.example.jinyu.R;
import com.example.jinyu.Service.ServiceUtil;

import db.bean.Notifys;

import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class WuYeTongZhiFragment extends Fragment implements OnItemClickListener{
	
	private ListView lv_tongzhi;
	private List<String> list;
	private String path="http://www.zdreamer.net/jinyu/notice/select.do";
	
	
	private Handler handler=new Handler(){
		@Override
		public void handleMessage(android.os.Message msg) {
			switch (msg.arg1) {
			case 1:
				//get the result A list<Notifys>
				List<Notifys> list_notify=JSONParseUtils.getJsonString((String)(msg.obj), Notifys.class);
				break;

			default:
				break;
			}
		};
	};
	
	
	//List------>String[]
		public String[] parseListToArray(List<String> list){
			String strings[]=new String[list.size()];
			for(int i=0,j=list.size();i<j;i++){
			strings[i]=list.get(i);
			}
			return strings;
		}
	
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		ServiceUtil.getResultFromNet(path, null, handler, 1);
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View v=inflater.inflate(R.layout.fg_tongzhi, container, false);
		lv_tongzhi=(ListView) v.findViewById(R.id.lv_tongzhi);
		return v;
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		// TODO Auto-generated method stub
		
	}
}
